package org.codefinger.dao.impl.sql.ast;

import org.codefinger.dao.impl.Querier;
import org.codefinger.dao.impl.SQLVisitor;
import org.codefinger.dao.impl.sql.Expression;

public class SubQueryExpression implements Expression {

	private Querier	querier;

	public SubQueryExpression(Querier querier) {
		super();
		this.querier = querier;
	}

	@Override
	public boolean matchVisit(SQLVisitor visitor) {
		return querier.visitAsSubQuery(visitor);
	}

	@Override
	public void visit(SQLVisitor visitor) {
		visitor.appendSQL('(');
		querier.visitAsQuery(visitor);
		visitor.appendSQL(')');
	}
	
}
